package com.wizards.mtg;

import java.util.ArrayList;
import java.util.List;

import com.wizards.mtg.zone.Battlefield;

public class Game 
{
	private final List<Player> players;
	private final Battlefield battlefield;
	
	private Card card; // Temp var for chained methods that move cards between zones
	
	public Game(int numPlayers) {
		this.players = new ArrayList<Player>();
		this.battlefield = new Battlefield();
		
		for (int i = 0; i < numPlayers; i++) {
			players.add(new Player());
		}
	}

	public List<Player> getPlayers() {
		return players;
	}
		
	public Game move(Card card) { this.card = card; return this; }	
	public Game toBattlefield() { to(battlefield); return this; }
	public Game toGraveyardOf(Player player) { to(player.getGraveyard()); return this; }
	public Game toHandOf(Player player)	{ to(player.getHand()); return this; }	
	
	private Game to(Zone newZone) { 
		if (card != null) {
			//card.getCurrentZone().remove(card);
			//card.setCurrentZone(newZone);
			newZone.add(card); 
			card = null; 
		}
		return this; 
	}

	public Battlefield getBattlefield() {
		return battlefield;
	}	
	
/*


	public Zone getCurrentZone()                          { return currentZone; }
	public void setCurrentZone(Zone zone)                 { this.currentZone = zone; }
 */
}
